<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>新增修改结清费用项</title>
    <jsp:include page="../../import.jsp" flush="true"/>
    <%--<style type="text/css">
        .searchArea .fieldBox .label{width: 70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
    </style>--%>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <form id="addOrEditSettleFeeForm">
        <div class="fieldset1 tabel_col clearFix">
            <div class="Hide">
                <input name="paySchDId" id="paySchDId" type="text" value="${fee.id}">
                <input name="paySchId" id="paySchId" type="text" value="${paySchId}">
                <input name="pInstId" id="pInstId" type="text" value="${pInstId}">
            </div>

            <div class="fieldBox col_100_auto">
                <div class="label">费用类型<span class="requiredSymbol">*</span></div>
                <div class="field">
                    <input name="feeTypCd" id="feeTypCd" data-value="${fee.feeTypCd}" placeholder="请选择"
                           ligerui="width: 200" ltype="combobox" validate="{required:true}"/>
                </div>
            </div>
            <div class="fieldBox col_100_auto">
                <div class="label">费用金额<span class="requiredSymbol">*</span></div>
                <div class="field">
                    <input name="feeAmt" id="feeAmt" type="text" class="ui-textbox" ligerui="width: 200"
                           value="<fmt:formatNumber value="${fee.feeAmt}" pattern="0.##"/>"
                           validate="{required:true,amount:true}">
                </div>
            </div>

            <div class="fieldBox col_100">
                <div class="label">备注</div>
                <div class="field">
                    <textarea name="feeRem" id="feeRem" rows="4" class="l-textarea" style="width:98%" value=""
                              validate="{required:false,maxlength:200}">${dealCost.costRem}</textarea>
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    var basePath = "<%=path%>";
    $(function () {
        $("#addOrEditSettleFeeForm").ligerForm({
            validate: true
        });

        $("#feeTypCd").ligerComboBox({
            valueField: 'key',
            textField: 'value',
            data: ${settleFeeDic}
        });

        // 点击确认事件
        frameElement.dialog.onOk = function () {
            var form = liger.get("addOrEditSettleFeeForm");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false;
            }
            var data = form.getData();
            data.id = $("#paySchDId").val();
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: basePath + '/settlement/fee/addOrEditSettleFee.do',
                beforeSend: function () {
                    wait_dialog = top.$.ligerDialog.SQalert({ content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting" });
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        top.$.ligerDialog.SQalert({
                            content: msg.info, SQ_showButtons: true, SQ_type: "success", onClose: function () {
                                frameElement.dialog.close();
                            }
                        });
                    } else {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        };

    });

</script>
</body>
</html>